package sdk.org.apache.shiro.utils;

import com.titan.common.v8.domain.PageContext;
import com.titan.common.v8.interfaces.IPage;
import com.titan.core.apidoc.annotations.ApiAuthor;
import com.titan.core.apidoc.annotations.ApiDescription;
import com.titan.core.apidoc.annotations.ApiEmail;
import com.titan.core.apidoc.annotations.ApiVersion;
import com.titan.core.utils.data.StringUtils;
import com.titan.services.GenerateCode.v8.ViewXML.tags.bootstrap4.Bootstrap4ContainerTagV8;
import com.titan.services.GenerateCode.v8.ViewXML.tpl.TplUtilsV8;
import com.titan.services.GenerateCode.v8.ViewXML.tpl.options.GridColOption;
import com.titan.services.GenerateCode.v8.ViewXML.tpl.options.GridOption;
import com.titan.services.GenerateCode.v8.ViewXML.tpl.options.PageOption;
import com.titan.services.GenerateCode.v8.ViewXML.utils.Bootstrap4UtilsV8;
import com.titan.services.GenerateCode.v8.ViewXML.utils.CustomUtilsV8;
import com.titan.services.GenerateCode.v8.ViewXML.utils.Html5UtilsV8;
import com.titan.services.GenerateCode.v8.common.domain.ViewXMLTagV8;
import com.titan.services.GenerateCode.v8.common.utils.JsBuilderV8;

/**
 * This software is Copyright ©2018 ChengGong studio. All Rights Reserved.
 * The source code contained in this listing is proprietary to 周成功工作室.
 * Unauthorized copying, adaptation, distribution, use, or display is strictly prohibited.
 */
@ApiDescription("所有页面的基类，包装各种习惯用法")
@ApiAuthor("周成功")
@ApiEmail("86898837@qq.com")
@ApiVersion("1.0.20190218")
public abstract class BasePage implements IPage {
    protected Bootstrap4UtilsV8 tplB4;
    protected Html5UtilsV8 tplH5;
    protected CustomUtilsV8 tplC8;
    protected TplUtilsV8 tplT8;
    
    
    public PageOption defaultContext(PageContext context) {
        return new PageOption("周成功", "ChengGong studio.", context);
    }
    
    public static String page(PageOption context, JsBuilderV8 style, JsBuilderV8 script, ViewXMLTagV8<?>...children) throws Exception {
        style.addLines("body{background:#d2d6de;}");
        // 整页布局
        Bootstrap4ContainerTagV8 container = TplUtilsV8.grid(GridOption.$()
            , GridColOption.$(12, "a-mt6 a-ml5 a-mr5 a-mb10", StringUtils.EMPTY, children)
            );
        return TplUtilsV8.page(context, style, script, container);
    }    
}
